package com.mtbu.bean.base;
import java.util.*;
import java.text.SimpleDateFormat;
import org.json.JSONObject;
import my.json.core.JsonAble;
public abstract class StatsPlaystartBase implements JsonAble {
    private Map<String, Object> dirtyProperties = new HashMap<String, Object>();
    //ID
    private long id = 0;
    //统计的日期
    private Date time = null;
    //
    private long count = 0;
    //
    private long A = 0;
    //
    private long C = 0;
    //
    private long L = 0;
    //
    private long M = 0;
    //
    private long N = 0;
    //
    private long P = 0;
    //
    private long Q = 0;
    //更新时间
    private Date updateTime = null;
    //创建时间
    private Date createTime = null;
    public long getId(){
        return this.id;
    }
    public void setId(long id){
        this.id = id;
    }
    public Date getTime(){
        return this.time;
    }
    public String getTime_ToDateString(){
        if(time==null) return "";
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
        return formatter.format(this.time);
    }
    public String getTime_ToTimeString(){
        if(time==null) return "";
        SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
        return formatter.format(this.time);
    }
    public String getTime_ToDateTimeString(){
        if(time==null)   return "";
        SimpleDateFormat   formatter   =   new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return formatter.format(this.time);
    }
    public void setTime(Date time){
        this.time = time;
        dirtyProperties.put("time", time);
    }
    public long getCount(){
        return this.count;
    }
    public void setCount(long count){
        this.count = count;
        dirtyProperties.put("count", count);
    }
    public long getA(){
        return this.A;
    }
    public void setA(long A){
        this.A = A;
        dirtyProperties.put("A", A);
    }
    public long getC(){
        return this.C;
    }
    public void setC(long C){
        this.C = C;
        dirtyProperties.put("C", C);
    }
    public long getL(){
        return this.L;
    }
    public void setL(long L){
        this.L = L;
        dirtyProperties.put("L", L);
    }
    public long getM(){
        return this.M;
    }
    public void setM(long M){
        this.M = M;
        dirtyProperties.put("M", M);
    }
    public long getN(){
        return this.N;
    }
    public void setN(long N){
        this.N = N;
        dirtyProperties.put("N", N);
    }
    public long getP(){
        return this.P;
    }
    public void setP(long P){
        this.P = P;
        dirtyProperties.put("P", P);
    }
    public long getQ(){
        return this.Q;
    }
    public void setQ(long Q){
        this.Q = Q;
        dirtyProperties.put("Q", Q);
    }
    public Date getUpdateTime(){
        return this.updateTime;
    }
    public String getUpdateTime_ToDateString(){
        if(updateTime==null) return "";
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
        return formatter.format(this.updateTime);
    }
    public String getUpdateTime_ToTimeString(){
        if(updateTime==null) return "";
        SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
        return formatter.format(this.updateTime);
    }
    public String getUpdateTime_ToDateTimeString(){
        if(updateTime==null)   return "";
        SimpleDateFormat   formatter   =   new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return formatter.format(this.updateTime);
    }
    public void setUpdateTime(Date updateTime){
        this.updateTime = updateTime;
        dirtyProperties.put("updateTime", updateTime);
    }
    public Date getCreateTime(){
        return this.createTime;
    }
    public String getCreateTime_ToDateString(){
        if(createTime==null) return "";
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
        return formatter.format(this.createTime);
    }
    public String getCreateTime_ToTimeString(){
        if(createTime==null) return "";
        SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
        return formatter.format(this.createTime);
    }
    public String getCreateTime_ToDateTimeString(){
        if(createTime==null)   return "";
        SimpleDateFormat   formatter   =   new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return formatter.format(this.createTime);
    }
    public void setCreateTime(Date createTime){
        this.createTime = createTime;
        dirtyProperties.put("createTime", createTime);
    }
    public Map<String, Object> getDirtyProperties() {
        return this.dirtyProperties;
    }
    public JSONObject toJSON() throws Exception {
        JSONObject json = new JSONObject();
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        json.put("id", this.getId());
        if(time!=null){
            json.put("time",formatter.format(this.getTime()));
        }
        json.put("count", this.getCount());
        json.put("A", this.getA());
        json.put("C", this.getC());
        json.put("L", this.getL());
        json.put("M", this.getM());
        json.put("N", this.getN());
        json.put("P", this.getP());
        json.put("Q", this.getQ());
        if(updateTime!=null){
            json.put("updateTime",formatter.format(this.getUpdateTime()));
        }
        if(createTime!=null){
            json.put("createTime",formatter.format(this.getCreateTime()));
        }
        return json;
    }
    public void fromJSON(JSONObject json) throws Exception {
        if(json==null) return;
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        try{
            if(json.get("id") != null){
                this.setId(Long.parseLong(json.get("id")+""));
            }
        }catch(Exception ex){
        }
        try{
            if(json.get("time") != null){
                this.setTime(formatter.parse(json.get("time")+""));
            }
        }catch(Exception ex){
        }
        try{
            if(json.get("count") != null){
                this.setCount(Long.parseLong(json.get("count")+""));
            }
        }catch(Exception ex){
        }
        try{
            if(json.get("A") != null){
                this.setA(Long.parseLong(json.get("A")+""));
            }
        }catch(Exception ex){
        }
        try{
            if(json.get("C") != null){
                this.setC(Long.parseLong(json.get("C")+""));
            }
        }catch(Exception ex){
        }
        try{
            if(json.get("L") != null){
                this.setL(Long.parseLong(json.get("L")+""));
            }
        }catch(Exception ex){
        }
        try{
            if(json.get("M") != null){
                this.setM(Long.parseLong(json.get("M")+""));
            }
        }catch(Exception ex){
        }
        try{
            if(json.get("N") != null){
                this.setN(Long.parseLong(json.get("N")+""));
            }
        }catch(Exception ex){
        }
        try{
            if(json.get("P") != null){
                this.setP(Long.parseLong(json.get("P")+""));
            }
        }catch(Exception ex){
        }
        try{
            if(json.get("Q") != null){
                this.setQ(Long.parseLong(json.get("Q")+""));
            }
        }catch(Exception ex){
        }
        try{
            if(json.get("updateTime") != null){
                this.setUpdateTime(formatter.parse(json.get("updateTime")+""));
            }
        }catch(Exception ex){
        }
        try{
            if(json.get("createTime") != null){
                this.setCreateTime(formatter.parse(json.get("createTime")+""));
            }
        }catch(Exception ex){
        }
    }
    public void fromMap(Map<String, String> json) throws Exception {
        if(json==null) return;
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        try {
            if(json.containsKey("id".toLowerCase())){
                this.setId(Long.parseLong(json.get("id".toLowerCase())+""));
            }
        }catch(Exception ex){
        }
        try {
            if(json.containsKey("time".toLowerCase())){
                this.setTime(formatter.parse(json.get("time".toLowerCase())+""));
            }
        }catch(Exception ex){
        }
        try {
            if(json.containsKey("count".toLowerCase())){
                this.setCount(Long.parseLong(json.get("count".toLowerCase())+""));
            }
        }catch(Exception ex){
        }
        try {
            if(json.containsKey("A".toLowerCase())){
                this.setA(Long.parseLong(json.get("A".toLowerCase())+""));
            }
        }catch(Exception ex){
        }
        try {
            if(json.containsKey("C".toLowerCase())){
                this.setC(Long.parseLong(json.get("C".toLowerCase())+""));
            }
        }catch(Exception ex){
        }
        try {
            if(json.containsKey("L".toLowerCase())){
                this.setL(Long.parseLong(json.get("L".toLowerCase())+""));
            }
        }catch(Exception ex){
        }
        try {
            if(json.containsKey("M".toLowerCase())){
                this.setM(Long.parseLong(json.get("M".toLowerCase())+""));
            }
        }catch(Exception ex){
        }
        try {
            if(json.containsKey("N".toLowerCase())){
                this.setN(Long.parseLong(json.get("N".toLowerCase())+""));
            }
        }catch(Exception ex){
        }
        try {
            if(json.containsKey("P".toLowerCase())){
                this.setP(Long.parseLong(json.get("P".toLowerCase())+""));
            }
        }catch(Exception ex){
        }
        try {
            if(json.containsKey("Q".toLowerCase())){
                this.setQ(Long.parseLong(json.get("Q".toLowerCase())+""));
            }
        }catch(Exception ex){
        }
        try {
            if(json.containsKey("updateTime".toLowerCase())){
                this.setUpdateTime(formatter.parse(json.get("updateTime".toLowerCase())+""));
            }
        }catch(Exception ex){
        }
        try {
            if(json.containsKey("createTime".toLowerCase())){
                this.setCreateTime(formatter.parse(json.get("createTime".toLowerCase())+""));
            }
        }catch(Exception ex){
        }
    }
}
